UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H36Xpyx0ll/uQ2GPN6GIvW/HB+yPt0UlWnYkg28F19Q=' 
WHERE 
  key_id = '11007e1ef0f352333ef4f725d7bfd3c2678eb1bba66c1c164b25e78c2011119a' 
  AND (
    token = 'H36Xpyx0ll/uQ2GPN6GIvW/HB+yPt0UlWnYkg28F19Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030