UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0M1WpFln8i49BdzfY6i9PTI28sSW3Qdb9aiLVS9oz+I=' 
WHERE 
  key_id = '5a9346f3befbc9cef0492a0264af20ec0f95a67773cbf138892186140cf6ac76' 
  AND (
    token = '0M1WpFln8i49BdzfY6i9PTI28sSW3Qdb9aiLVS9oz+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038