UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y/UBtRL+9FLNiSSEwg60rHXYrCe78EfNTeqX8oC0pLs=' 
WHERE 
  key_id = '25cf5913423386d8bfeaeadfd3043cd5acde3634c26c19a6fdb22ca2eb7db91c' 
  AND (
    token = 'y/UBtRL+9FLNiSSEwg60rHXYrCe78EfNTeqX8oC0pLs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045