UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lhqAkVNFUfu+zOg63VqOSi+Imw+0QNWzV3zUFZ9E/m0=' 
WHERE 
  key_id = '0ee8472d21a017aa3c8c589952d009d8d699344e67aa53e2f0d86464e70f9b12' 
  AND (
    token = 'lhqAkVNFUfu+zOg63VqOSi+Imw+0QNWzV3zUFZ9E/m0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041