UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ntaWTU7qcyI4B2sk+7axyTAYhfmUVgoX5gRElXQwJAc=' 
WHERE 
  key_id = '5949019d82f02c616fc32a5d5e01e48939b306e2b481f0dcc60de8fcf8962a9c' 
  AND (
    token = 'ntaWTU7qcyI4B2sk+7axyTAYhfmUVgoX5gRElXQwJAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030