UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nFYybzjoATJXetf8J2FemTQbH4UdaZWRHdkVodPqSnI=' 
WHERE 
  key_id = 'a348f3d5f496edbdf7f08b1f5e62ee4a5f6a0601da91b2a82b5b874d2f92e3ef' 
  AND (
    token = 'nFYybzjoATJXetf8J2FemTQbH4UdaZWRHdkVodPqSnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037