UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9WXkqo5O2wikRAZmWKVvpx5As1J39d70lTGjV8u5hXc=' 
WHERE 
  key_id = '5b43b4f8aaaf6cba6896c55610e2793e7e8dd56eb4b9fc4f5d30f20c4fee5434' 
  AND (
    token = '9WXkqo5O2wikRAZmWKVvpx5As1J39d70lTGjV8u5hXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032