UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hR9hvvmN6p17jtcxcDrSH1iWr/tv5vgQdMV8mNa3ras=' 
WHERE 
  key_id = '51126e6cff08fe82cf1cb6da6a2fb87e24dae22da770bd1537477c5305b53ad9' 
  AND (
    token = 'hR9hvvmN6p17jtcxcDrSH1iWr/tv5vgQdMV8mNa3ras=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047