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

Query time 0.00031