UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nvmK7Arv2kHPY5GXOFEyjHgdnHPh5UmTq0YyC6E4b9c=' 
WHERE 
  key_id = '89fc5282505211e7011bf2dcb954b3a195ce9b7adaad25ca3d14c05ae6d30bc7' 
  AND (
    token = 'nvmK7Arv2kHPY5GXOFEyjHgdnHPh5UmTq0YyC6E4b9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032