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

Query time 0.00033