UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NckvQcwUmb2ZC0QDUffhbgtdp3FS1kU2KPMZizE5p2Q=' 
WHERE 
  key_id = '6a89261e1167c55e9054a809a1c46239dcb6a58c410e04c1c12ebcd49d24ef60' 
  AND (
    token = 'NckvQcwUmb2ZC0QDUffhbgtdp3FS1kU2KPMZizE5p2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054