UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JIMXRbF23jNdTD+6aa7lmumiuX6uZYx/0YtNAl8P/aQ=' 
WHERE 
  key_id = '8f86a33ee36f7af347dc619e47d151e5c7ab8d582cd8f8b0d9eaa64803f1e5db' 
  AND (
    token = 'JIMXRbF23jNdTD+6aa7lmumiuX6uZYx/0YtNAl8P/aQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043