UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q9Q7TMx8XFJQv2jOevB98J+6U7/OprqF+O19KxAjpEQ=' 
WHERE 
  key_id = '03b8290b9932faadabec1bf71a12cefd9aa53c442d8690fd50645984818abc33' 
  AND (
    token = 'Q9Q7TMx8XFJQv2jOevB98J+6U7/OprqF+O19KxAjpEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017