UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V15eee5bLSO5bwH6awAGCABZ3MDIP7bQMY+wo3TZBZs=' 
WHERE 
  key_id = '9a7f6e96539c635ada5d66f3d0bdb2f3454ef7c9690f451d7a79cf5ca8a08afb' 
  AND (
    token = 'V15eee5bLSO5bwH6awAGCABZ3MDIP7bQMY+wo3TZBZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057