UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jmJTnICPg7z8FM/3EEponffkqhxJmn40REAQh6dcmxI=' 
WHERE 
  key_id = '87e2744dee1f37cf49d3984ebf3faa8b5028912feeac8aea211200b03e87a389' 
  AND (
    token = 'jmJTnICPg7z8FM/3EEponffkqhxJmn40REAQh6dcmxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040