UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FOVrgONxvPax1ky78pfGG9dn9DFErRTcwd4KEJFKdDc=' 
WHERE 
  key_id = '4ab2dfaa18c4593e6dd2b42c4299798e31f3e80ba2bee8898e815b6088676420' 
  AND (
    token = 'FOVrgONxvPax1ky78pfGG9dn9DFErRTcwd4KEJFKdDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034