UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KXN/68rYRQ7c4x2DwudPYt7Vn2iePB55lZcDBUFc1O8=' 
WHERE 
  key_id = '7de91dafc52c3bbe522e32fbe3d5bd7e9328aac4e30ccbe89d223b5786203bf0' 
  AND (
    token = 'KXN/68rYRQ7c4x2DwudPYt7Vn2iePB55lZcDBUFc1O8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027