UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZZjYVZ1LWfDyp4CHuWKfCM6Gw5qePDUD47c7Rd0NBr8=' 
WHERE 
  key_id = '53a1caa32e0290ebbc70ab5df23dd190fff5c24e74141f6cad0cadf046139312' 
  AND (
    token = 'ZZjYVZ1LWfDyp4CHuWKfCM6Gw5qePDUD47c7Rd0NBr8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044