UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gBooYXik5EHOshoYLZqLcf7XgYYOCwWDrG7bYe/wQq8=' 
WHERE 
  key_id = '6ff99f032f1fb2010835817389d9f0a8a1019381617e5ebb32ee310a5a1f15b0' 
  AND (
    token = 'gBooYXik5EHOshoYLZqLcf7XgYYOCwWDrG7bYe/wQq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016