UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uz6E5kdwWQitD0M7YHk48YPumXucrIBhBQ4+NzIAyN0=' 
WHERE 
  key_id = '7accc41f8d72199034f3545d9e2ec80a6460a50ff222135ccd5b8d185e68a115' 
  AND (
    token = 'uz6E5kdwWQitD0M7YHk48YPumXucrIBhBQ4+NzIAyN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040