UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'renUEyOomBtUc63scx96t6oWIe1BVN1jQ+k3z1zuiUk=' 
WHERE 
  key_id = '2892bb3c249db9e2055f88c5697c7bb923c99de1691b1991ad3eed29144f7b11' 
  AND (
    token = 'renUEyOomBtUc63scx96t6oWIe1BVN1jQ+k3z1zuiUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027