UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mTJWqLIaFNJEk6ZOhdCPD8Qx17BCrVn2t9iY3oNSEMI=' 
WHERE 
  key_id = '71f0316ec9a610ff8d2c89448a1a937de7cda25438cb3e88a120e26a60097a43' 
  AND (
    token = 'mTJWqLIaFNJEk6ZOhdCPD8Qx17BCrVn2t9iY3oNSEMI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038