UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DJ6MdRpRKBlDAWkF+iqT0+AsdSCjkqPTBmspRgF8CYc=' 
WHERE 
  key_id = '393f4c3b5e4f4cb23e7e0ad1e720f09375ba8277b8d7948ac154531843a2b9f8' 
  AND (
    token = 'DJ6MdRpRKBlDAWkF+iqT0+AsdSCjkqPTBmspRgF8CYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038