UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HEt0azuZzaNQUx835QrIS8+bgtuB2vQ4In/CTk777LY=' 
WHERE 
  key_id = '2a6db25543aa724c4b5f424984eb173672accd2269255237ec26bf8227667707' 
  AND (
    token = 'HEt0azuZzaNQUx835QrIS8+bgtuB2vQ4In/CTk777LY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039