UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SpekSkpfAwsfD0QqeQAFoLGKLI9ZGMgtM2i7+4oG8YI=' 
WHERE 
  key_id = '24efb7ec616b39104ea90dd4e68e47953ffa47b293bc69b6607428eb1f70bd20' 
  AND (
    token = 'SpekSkpfAwsfD0QqeQAFoLGKLI9ZGMgtM2i7+4oG8YI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032