UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oOJim/AXebnt0iMwmwcuy4BWZx8aFecOvkb5dLSgzsA=' 
WHERE 
  key_id = '0f9b479acedb99793300909306b4862aaec82f78ccf817b3a41b5bb39c6da709' 
  AND (
    token = 'oOJim/AXebnt0iMwmwcuy4BWZx8aFecOvkb5dLSgzsA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034