UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YqGzos1YuHlhDDX+xodWU8I2hpiCajsu7Shfjb+LtSQ=' 
WHERE 
  key_id = '905921ddd15fe1abd4b53e63cd8c72e2428884792e79628761a981d1b1182390' 
  AND (
    token = 'YqGzos1YuHlhDDX+xodWU8I2hpiCajsu7Shfjb+LtSQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054