UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YGIGaLgJXzd1ktHW2SDA7y1nzV+A3VbdDIEIijmuCYk=' 
WHERE 
  key_id = '9e270f2767398f5cad3ba4bfaf2c50a27ee71e9c83d8ca8acea42ba2df5d70c3' 
  AND (
    token = 'YGIGaLgJXzd1ktHW2SDA7y1nzV+A3VbdDIEIijmuCYk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032